package com.baidu.push.example;




import android.app.Fragment;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ScrollView;
import android.widget.TextView;

import com.chinatelecom.epush.R;

public class NewsFragment extends Fragment {
	
	private static final String TAG = NewsFragment.class.getSimpleName();
	TextView logText = null;
	private Handler handler;
    ScrollView scrollView = null;
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View newsLayout = inflater.inflate(R.layout.news_layout, container,
				false);
		logText = (TextView)newsLayout.findViewById(R.id.text_log);
		scrollView = (ScrollView)newsLayout.findViewById(R.id.stroll_text);
		
		return newsLayout;
	}

	@Override
	public void onResume() {
		super.onResume();
//		logText.setText(Utils.logStringCache);
//		System.out.println(Utils.logStringCache);
//		logText.setText(Utils.logStringCache);
		updateDisplay();
	}
	
	
    // 更新界面显示内容
    private void updateDisplay() {
        Log.d(TAG, "updateDisplay, logText:" + logText + " cache: "
                + Utils.logStringCache);
        if (logText != null) {
            logText.setText(Utils.logStringCache);
        }
        if (scrollView != null) {
            scrollView.fullScroll(ScrollView.FOCUS_DOWN);
        }
    }
	
//    private void updateDisplay() {
//        Log.d(TAG, "updateDisplay, logText:" + logText + " cache: "
//                + Utils.logStringCache);
//        if (logText != null) {
//            logText.setText(Utils.logStringCache);
//        }
//        if (scrollView != null) {
//            scrollView.fullScroll(ScrollView.FOCUS_DOWN);
//        }
//    }

}
